package aufgabe3;

/**
 * @author Johannes Riedmann
 * @author David Medenjak
 * @author Lukas Koell
 */
public class Rectangle implements ScaleablePolygon{

    /**
     * Object member variables
     */
    private float width, height;
    
    /**
     * @param width > 0.00
     * @param height > 0.00
     */
    public Rectangle(float width, float height){
        this.width = width;
        this.height = height;
    }
    
    /**
     * @return number of edges of rectangle == 4
     */
    public int edges(){
        return 4;
    }
    
    /**
     * @return area of rectangle > 0.00
     */
    public double area(){
        return width * height;
    }
    
    /**
     * @return perimeter of rectangle > 0.00
     */
    public double perimeter(){
        return 2 * (width + height);
    }
    
    /**
     * resizes the rectangles width and height by a scale-factor
     * @params factor > 0.00
     */
    public void scale(float factor){
        width *= factor;
        height *= factor;
    }
}
